package com.yanfan.ccapicode.handler.factory;

import com.yanfan.ccapicode.strategy.StrategyComponent;

import java.util.Map;

/**
 * :)
 *
 */
public abstract class AbstractStrategyFactory implements StrategyFactory {

    abstract Map<String, StrategyComponent> strategyStore();

    @Override
    public void register(String key, StrategyComponent t) {
        strategyStore().put(key, t);
    }


    @Override
    public <T>T getStrategy(String key, Class<T> tClass) {
        return (T)strategyStore().get(key);
    }
}
